const { UUIDV4, UUID, STRING, TEXT, JSON, INTEGER, Model } = require('sequelize');
const db = require('../../helpers/db');
const Goods = require('./goods');

class GoodsCategory extends Model {}

GoodsCategory.init(
    {
        id: {
            type: UUID,
            defaultValue: UUIDV4,
            primaryKey: true,
            comment: '商品详情ID'
        },
        goods: {
            type: STRING(512),
            comment: '外键，商品ID',
            allowNull: false,
        },
        category: {
            type: INTEGER(11),
            comment: '外键，商品分类ID',
            allowNull: false
        }
    },
    {
        tableName: 'goods_category',
        underscored: true,
        sequelize: db
    }
);

module.exports = GoodsCategory;
